﻿<%@ Page Title="" Language="C#" MasterPageFile="~/TsSite.Master" AutoEventWireup="true" CodeBehind="EditInvoice.aspx.cs" Inherits="TireService.Web.Finance.EditInvoice" %>

<%@ Register assembly="DevExpress.Web.v10.2.Linq, Version=10.2.8.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" Namespace="DevExpress.Data.Linq" TagPrefix="dxdtlnq" %>
<%@ Register assembly="DevExpress.Web.ASPxGridView.v10.2, Version=10.2.8.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" namespace="DevExpress.Web.ASPxGridView" tagprefix="dxwgv" %>
<%@ Register assembly="DevExpress.Web.ASPxEditors.v10.2, Version=10.2.8.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" namespace="DevExpress.Web.ASPxEditors" tagprefix="dx" %>
<%@ Register assembly="DevExpress.Web.v10.2, Version=10.2.8.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" namespace="DevExpress.Web.ASPxPanel" tagprefix="dx" %>
<%@ Register Assembly="DevExpress.Web.v10.2, Version=10.2.8.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" Namespace="DevExpress.Web.ASPxRoundPanel" TagPrefix="dx" %>


<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">

    <script src="../Scripts/ModalPopup.js" type="text/javascript"></script>

    <dx:ASPxRoundPanel ID="rpContent" runat="server" Width="100%" ShowHeader="true" Height="100%">
        <PanelCollection>
            <dx:PanelContent ID="PanelContent1" runat="server">
                
                <asp:UpdatePanel ID="upMessage" runat="server" UpdateMode="Conditional">
                    <ContentTemplate>
                        <table border="0" cellspacing="0" cellpadding="5">
                            <tr>
                                <td>
                                    <div style="font-family: Tahoma; font-size: 9pt; font-weight: normal; color: #f15e34">
                                        &nbsp;<asp:Literal ID="lMessage" runat="server"></asp:Literal>
                                    </div>
                                </td>
                            </tr>
                        </table>          
                    </ContentTemplate>
                </asp:UpdatePanel>
                
                <h3>Faktura</h3>
                <table width="600px" border="0" cellpadding="3" cellspacing="3">
                    <tr>
                        <td>
                            <asp:Label ID="lblInvoiceDate" runat="server" Text="Fakturadato"></asp:Label>
                        </td>
                        <td>
                            <dx:ASPxDateEdit ID="txtInvoiceDate" runat="server">
                            </dx:ASPxDateEdit>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <asp:Label ID="lblDueDate" runat="server" Text="Forfaldsdato"></asp:Label>
                        </td>
                        <td>
                            <dx:ASPxDateEdit ID="txtDueDate" runat="server">
                            </dx:ASPxDateEdit>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <asp:Label ID="lblCustomerId" runat="server" Text="Kundenr"></asp:Label>
                        </td>
                        <td><asp:Label ID="lblCustomerIdValue" runat="server" Text=""></asp:Label></td>
                    </tr>
                    <tr>
                        <td>
                            <asp:Label ID="lblInvoiceStatus" runat="server" Text="Status"></asp:Label>
                        </td>
                        <td><asp:Label ID="lblInvoiceStatusValue" runat="server" Text=""></asp:Label></td>
                    </tr>
                    <tr>
                        <td colspan="2">
                            <asp:Button ID="btnSaveInvoice" runat="server" Text="Gem faktura header" 
                                onclick="btnSaveInvoice_Click" /> | 
                            <asp:HyperLink ID="hlPrintInvoice" Target="_blank" runat="server">Udskriv faktura</asp:HyperLink>
                        </td>
                    </tr>
                </table>

                <h3>Fakturalinjer</h3>  
                <table width="750px" border="0" cellpadding="3" cellspacing="3">
                    <tr>
                        <td>
                            <asp:Label ID="lblDescription" runat="server" Text="Beskrivelse"></asp:Label>
                        </td>
                        <td>
                            <asp:Label ID="lblPrice" runat="server" Text="Pris inkl. moms"></asp:Label>
                        </td>
                        <td>
                        
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <asp:TextBox ID="txtDescription" runat="server"></asp:TextBox>
                        </td>
                        <td>
                            <asp:TextBox ID="txtPrice" runat="server"></asp:TextBox>
                        </td>
                        <td>
                            <asp:Button ID="btnSaveInvoiceDetail" runat="server" Text="Gem linje" 
                                onclick="btnSaveInvoiceDetail_Click" />
                        </td>
                    </tr>
                </table>
                
                <dxwgv:ASPxGridView ID="gvInvoice" runat="server" 
                    ClientInstanceName="gvInvoice" Width="100%" EnableRowsCache="False" 
                    AutoGenerateColumns="False" EnableCallBacks="False" 
                    onrowdeleting="gvInvoice_RowDeleting"
                    oncustomunboundcolumndata="gvInvoice_CustomUnboundColumnData" 
                    oncustombuttoncallback="gvInvoice_CustomButtonCallback" 
                    KeyFieldName="InvoiceDetailId">
                    <SettingsLoadingPanel Text="Henter&amp;hellip;" />
                    <Columns>
                        <dxwgv:GridViewCommandColumn VisibleIndex="0">
                            <EditButton Visible="True" Text="Rediger">
                            </EditButton>
                            <DeleteButton Visible="True" Text="Slet">
                            </DeleteButton>
                        </dxwgv:GridViewCommandColumn>
                        <dxwgv:GridViewDataTextColumn FieldName="InvoiceDetailId" ReadOnly="True" 
                            VisibleIndex="1">
                        </dxwgv:GridViewDataTextColumn>
                        <dxwgv:GridViewDataTextColumn FieldName="InvoiceId" ReadOnly="True" 
                            VisibleIndex="2">
                        </dxwgv:GridViewDataTextColumn>
                        <dxwgv:GridViewDataTextColumn FieldName="Description" VisibleIndex="3">
                        </dxwgv:GridViewDataTextColumn>
                        <dxwgv:GridViewDataTextColumn FieldName="Price" VisibleIndex="4">
                        </dxwgv:GridViewDataTextColumn>
                    </Columns>
                    <Settings ShowFooter="true" />
                    <SettingsPager AlwaysShowPager="True" PageSize="20" Position="TopAndBottom">
                        <Summary 
                            AllPagesText="Sider: {0} - {1} ({2} linjer)" 
                            Text="Side {0} af {1} ({2} linjer)" />
                    </SettingsPager>
                    <SettingsText ConfirmDelete="Vil du slette denne linje?" />
                    <SettingsBehavior ConfirmDelete="True" AllowGroup="true" AllowDragDrop="true" />
                    
                    <TotalSummary>
                        <dxwgv:ASPxSummaryItem Tag="Total pris ex. moms" FieldName="Price" SummaryType="Sum" DisplayFormat="N"/>
                        <dxwgv:ASPxSummaryItem Tag="Total pris inkl. moms" FieldName="PriceIncVat" SummaryType="Sum" DisplayFormat="N"/>
                    </TotalSummary> 
                    
                </dxwgv:ASPxGridView>
                
            </dx:PanelContent>
        </PanelCollection>
        <HeaderTemplate>
            <table cellpadding="0" cellspacing="2" border="0">
                <tr>
                    <td>
                        <img id="imgEditInvoice" alt="" src="~/Images/Medium/cashier.png" runat="server" style="width: 32px; height: 32px" />
                    </td>
                    <td valign="middle">
                        <h3><asp:Label ID="lblInvoiceHeader" runat="server" Text="Rediger faktura"></asp:Label></h3>
                    </td>
                </tr>
            </table>
        </HeaderTemplate>
    </dx:ASPxRoundPanel>

</asp:Content>
